{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nimport { createPortal } from 'react-dom';\nimport canUseDom from \"rc-util/es/Dom/canUseDom\";\nimport { supportRef, useComposeRef } from \"rc-util/es/ref\";\nimport OrderContext from \"./Context\";\nimport useDom from \"./useDom\";\nimport useScrollLocker from \"./useScrollLocker\";\nimport { inlineMock } from \"./mock\";\nvar getPortalContainer = function getPortalContainer(getContainer) {\n  if (getContainer === false) {\n    return false;\n  }\n  if (!canUseDom() || !getContainer) {\n    return null;\n  }\n  if (typeof getContainer === 'string') {\n    return document.querySelector(getContainer);\n  }\n  if (typeof getContainer === 'function') {\n    return getContainer();\n  }\n  return getContainer;\n};\nvar Portal = /*#__PURE__*/React.forwardRef(function (props, ref) {\n  var open = props.open,\n    autoLock = props.autoLock,\n    getContainer = props.getContainer,\n    debug = props.debug,\n    _props$autoDestroy = props.autoDestroy,\n    autoDestroy = _props$autoDestroy === void 0 ? true : _props$autoDestroy,\n    children = props.children;\n  var _React$useState = React.useState(open),\n    _React$useState2 = _slicedToArray(_React$useState, 2),\n    shouldRender = _React$useState2[0],\n    setShouldRender = _React$useState2[1];\n  var mergedRender = shouldRender || open; // ====================== Should Render ======================\n\n  React.useEffect(function () {\n    if (autoDestroy || open) {\n      setShouldRender(open);\n    }\n  }, [open, autoDestroy]); // ======================== Container ========================\n\n  var _React$useState3 = React.useState(function () {\n      return getPortalContainer(getContainer);\n    }),\n    _React$useState4 = _slicedToArray(_React$useState3, 2),\n    innerContainer = _React$useState4[0],\n    setInnerContainer = _React$useState4[1];\n  React.useEffect(function () {\n    var customizeContainer = getPortalContainer(getContainer); // Tell component that we check this in effect which is safe to be `null`\n\n    setInnerContainer(customizeContainer !== null && customizeContainer !== void 0 ? customizeContainer : null);\n  });\n  var _useDom = useDom(mergedRender && !innerContainer, debug),\n    _useDom2 = _slicedToArray(_useDom, 2),\n    defaultContainer = _useDom2[0],\n    queueCreate = _useDom2[1];\n  var mergedContainer = innerContainer !== null && innerContainer !== void 0 ? innerContainer : defaultContainer; // ========================= Locker ==========================\n\n  useScrollLocker(autoLock && open && canUseDom() && (mergedContainer === defaultContainer || mergedContainer === document.body)); // =========================== Ref ===========================\n\n  var childRef = null;\n  if (children && supportRef(children) && ref) {\n    var _ref = children;\n    childRef = _ref.ref;\n  }\n  var mergedRef = useComposeRef(childRef, ref); // ========================= Render ==========================\n  // Do not render when nothing need render\n  // When innerContainer is `undefined`, it may not ready since user use ref in the same render\n\n  if (!mergedRender || !canUseDom() || innerContainer === undefined) {\n    return null;\n  } // Render inline\n\n  var renderInline = mergedContainer === false || inlineMock();\n  var reffedChildren = children;\n  if (ref) {\n    reffedChildren = /*#__PURE__*/React.cloneElement(children, {\n      ref: mergedRef\n    });\n  }\n  return /*#__PURE__*/React.createElement(OrderContext.Provider, {\n    value: queueCreate\n  }, renderInline ? reffedChildren : /*#__PURE__*/createPortal(reffedChildren, mergedContainer));\n});\nif (process.env.NODE_ENV !== 'production') {\n  Portal.displayName = 'Portal';\n}\nexport default Portal;","map":{"version":3,"names":["_slicedToArray","React","createPortal","canUseDom","supportRef","useComposeRef","OrderContext","useDom","useScrollLocker","inlineMock","getPortalContainer","getContainer","document","querySelector","Portal","forwardRef","props","ref","open","autoLock","debug","_props$autoDestroy","autoDestroy","children","_React$useState","useState","_React$useState2","shouldRender","setShouldRender","mergedRender","useEffect","_React$useState3","_React$useState4","innerContainer","setInnerContainer","customizeContainer","_useDom","_useDom2","defaultContainer","queueCreate","mergedContainer","body","childRef","_ref","mergedRef","undefined","renderInline","reffedChildren","cloneElement","createElement","Provider","value","process","env","NODE_ENV","displayName"],"sources":["/data/messenger.client/node_modules/@rc-component/portal/es/Portal.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nimport { createPortal } from 'react-dom';\nimport canUseDom from \"rc-util/es/Dom/canUseDom\";\nimport { supportRef, useComposeRef } from \"rc-util/es/ref\";\nimport OrderContext from \"./Context\";\nimport useDom from \"./useDom\";\nimport useScrollLocker from \"./useScrollLocker\";\nimport { inlineMock } from \"./mock\";\n\nvar getPortalContainer = function getPortalContainer(getContainer) {\n  if (getContainer === false) {\n    return false;\n  }\n\n  if (!canUseDom() || !getContainer) {\n    return null;\n  }\n\n  if (typeof getContainer === 'string') {\n    return document.querySelector(getContainer);\n  }\n\n  if (typeof getContainer === 'function') {\n    return getContainer();\n  }\n\n  return getContainer;\n};\n\nvar Portal = /*#__PURE__*/React.forwardRef(function (props, ref) {\n  var open = props.open,\n      autoLock = props.autoLock,\n      getContainer = props.getContainer,\n      debug = props.debug,\n      _props$autoDestroy = props.autoDestroy,\n      autoDestroy = _props$autoDestroy === void 0 ? true : _props$autoDestroy,\n      children = props.children;\n\n  var _React$useState = React.useState(open),\n      _React$useState2 = _slicedToArray(_React$useState, 2),\n      shouldRender = _React$useState2[0],\n      setShouldRender = _React$useState2[1];\n\n  var mergedRender = shouldRender || open; // ====================== Should Render ======================\n\n  React.useEffect(function () {\n    if (autoDestroy || open) {\n      setShouldRender(open);\n    }\n  }, [open, autoDestroy]); // ======================== Container ========================\n\n  var _React$useState3 = React.useState(function () {\n    return getPortalContainer(getContainer);\n  }),\n      _React$useState4 = _slicedToArray(_React$useState3, 2),\n      innerContainer = _React$useState4[0],\n      setInnerContainer = _React$useState4[1];\n\n  React.useEffect(function () {\n    var customizeContainer = getPortalContainer(getContainer); // Tell component that we check this in effect which is safe to be `null`\n\n    setInnerContainer(customizeContainer !== null && customizeContainer !== void 0 ? customizeContainer : null);\n  });\n\n  var _useDom = useDom(mergedRender && !innerContainer, debug),\n      _useDom2 = _slicedToArray(_useDom, 2),\n      defaultContainer = _useDom2[0],\n      queueCreate = _useDom2[1];\n\n  var mergedContainer = innerContainer !== null && innerContainer !== void 0 ? innerContainer : defaultContainer; // ========================= Locker ==========================\n\n  useScrollLocker(autoLock && open && canUseDom() && (mergedContainer === defaultContainer || mergedContainer === document.body)); // =========================== Ref ===========================\n\n  var childRef = null;\n\n  if (children && supportRef(children) && ref) {\n    var _ref = children;\n    childRef = _ref.ref;\n  }\n\n  var mergedRef = useComposeRef(childRef, ref); // ========================= Render ==========================\n  // Do not render when nothing need render\n  // When innerContainer is `undefined`, it may not ready since user use ref in the same render\n\n  if (!mergedRender || !canUseDom() || innerContainer === undefined) {\n    return null;\n  } // Render inline\n\n\n  var renderInline = mergedContainer === false || inlineMock();\n  var reffedChildren = children;\n\n  if (ref) {\n    reffedChildren = /*#__PURE__*/React.cloneElement(children, {\n      ref: mergedRef\n    });\n  }\n\n  return /*#__PURE__*/React.createElement(OrderContext.Provider, {\n    value: queueCreate\n  }, renderInline ? reffedChildren : /*#__PURE__*/createPortal(reffedChildren, mergedContainer));\n});\n\nif (process.env.NODE_ENV !== 'production') {\n  Portal.displayName = 'Portal';\n}\n\nexport default Portal;"],"mappings":"AAAA,OAAOA,cAAc,MAAM,0CAA0C;AACrE,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,YAAY,QAAQ,WAAW;AACxC,OAAOC,SAAS,MAAM,0BAA0B;AAChD,SAASC,UAAU,EAAEC,aAAa,QAAQ,gBAAgB;AAC1D,OAAOC,YAAY,MAAM,WAAW;AACpC,OAAOC,MAAM,MAAM,UAAU;AAC7B,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,SAASC,UAAU,QAAQ,QAAQ;AAEnC,IAAIC,kBAAkB,GAAG,SAASA,kBAAkB,CAACC,YAAY,EAAE;EACjE,IAAIA,YAAY,KAAK,KAAK,EAAE;IAC1B,OAAO,KAAK;EACd;EAEA,IAAI,CAACR,SAAS,EAAE,IAAI,CAACQ,YAAY,EAAE;IACjC,OAAO,IAAI;EACb;EAEA,IAAI,OAAOA,YAAY,KAAK,QAAQ,EAAE;IACpC,OAAOC,QAAQ,CAACC,aAAa,CAACF,YAAY,CAAC;EAC7C;EAEA,IAAI,OAAOA,YAAY,KAAK,UAAU,EAAE;IACtC,OAAOA,YAAY,EAA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